Xbasic

FILE.CLOSE Function

Syntax

V file_pointer.Close()

Description

Close an open file.

Discussion

The .CLOSE() method closes the file referenced by the object pointer .

Example

Open a file, print its size in bytes, and then close the file.

filename = ui_get_file("Open a Text File", "Text Files (*.txt)", "", "X")
if (filename = "") then
    end
end if
file_pointer = file.open(filename, FILE_RW_SHARED)
trace.writeln("File is now open.")
bytes = file_pointer.bytes_get()
trace.writeln("Bytes:" + str(bytes))
file_pointer.close()
trace.writeln("File is now closed.")

See Also